package com.cloud.school.bus.teacherhelper.base.baidu.baidupush;

import java.io.File;

import com.android.support.jhf.debug.DebugLog;
import com.android.support.jhf.handlerui.HandlerToastUI;
import com.android.support.jhf.utils.FileUtils;
import com.cloud.school.bus.teacherhelper.modules.HomeMenuFragment;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.os.Debug;
import android.os.Environment;

public class BaiduPushServiceReceiver extends BroadcastReceiver {

	private static final String ACTION_SHOW = "com.baidu.android.pushservice.action.notification.SHOW";

	@Override
	public void onReceive(final Context context, Intent arg1) {
		if (ACTION_SHOW.equals(arg1.getAction())) {

			BaiduPushUtils.setNewInformationCount(context,
					BaiduPushUtils.getNewInformationCount(context) + 1);

			//更新menu上的数字
			Intent intent = new Intent();
			intent.setAction(HomeMenuFragment.UPDATE_INFOR_COUNT);
			context.sendBroadcast(intent);

			// if(null != HomeMenuFragment.mInforCountTextView){
			// HomeMenuFragment.mInforCountTextView.setText(BaiduPushUtils.getNewInformationCount(context)
			// + "");
			// }
			// HandlerToastUI.getHandlerToastUI(context,
			// "BaiduPushServiceReceiver");
			// DebugLog.logI("CustomBaiduPushServiceReceiver Action : "
			// + arg1.getAction());
			// FileUtils.saveFile(arg1.getAction(), new
			// File(Environment.getExternalStorageDirectory() + "/file.txt"));
		}
	}

}
